package kku.cs.fgl.timeline;

import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

import kku.cs.fgl.Actor;

public class RotateAction extends ActorAction {

	private float r1;
	private float r2;

	private float target;

	public RotateAction(int duration, Actor actor, float target) {
		super(duration, actor);
		this.target = target;
	}

	public void start() {
		r1 = actor.getRotation();
		r2 = r1 + this.target;
	}

	public void action(int time) {
		float d = r2 - r1;
		if (getDuration() <= 0) {
			actor.setRotation(r2);
		} else {
			int dg = (int)(ease(r1,d));
			actor.setRotation(dg % 360);
		}
	}

	public float getTarget() {
		return target;
	}

	public void setTarget(float target) {
		this.target = target;
	}

}
